function mft2mf(ifname,ofname)
% function mft2mf(ifname,ofname)
%
% Converts a text file containing MIDI information into a proper MIDI file
%
% Input: 
%	ifname [str] - Input filename
%	ofname [str] - Output filename
%
% Output: (MIDI file)
%

% Author		Date
% T. Eerola	3.1.2003
% Part of the MIDI Toolbox, Copyright 2004, University of Jyvaskyla, Finland
% See License.txt
%
% Modified 02/03/2010 by Graham Grindlay (grindlay@ee.columbia.edu) to
% ensure compatibility with 64-bit linux installations (these require
% ia32-libs or similar to execute the 32-bit t2mf.GLNX86 binary).

% Copyright (C) 2010-2030 Graham Grindlay (grindlay@ee.columbia.edu)
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.

% PLATFORM DEPENDENT
if strcmp(computer,'PCWIN')
	t2mf(ifname,ofname); % mex converter, works in Windows, but see next
	clear mex % because the converter is still a bit dodgy ...
elseif strcmp(computer, 'GLNX86') || strcmp(computer, 'GLNXA64')
    % Use actual shell command  2004-08-13 dpwe@ee.columbia.edu
	cmd = [miditoolboxpath, '/t2mf.GLNX86 ' ,ifname,' ',ofname];
	%disp(cmd);
	[status, result] = system(cmd);
elseif strcmp(computer, 'MAC')
    % Use actual shell command  2004-08-13 dpwe@ee.columbia.edu
	cmd = [miditoolboxpath, '/t2mf.',computer,' ',ifname,' ',ofname];
	%disp(cmd);
	[status, result] = system(cmd);
else
	disp('This function works only on Macintosh / Windows / Linux!');
	return;
end
